Function range_duplicate_removal_beta(range_data As Range, Optional ByVal sign As String = "、")

Dim nameArr, strDic
Dim nameStr As String
'创建集合对象
Set strDic = CreateObject("Scripting.Dictionary")
'循环单元格
For Each r_str In range_data
    '判断单元格是否为空
    If r_str.Value <> "" Then
    nameStr = nameStr + r_str.Value + sign
    End If
Next
'去空格
nameStr = Replace(nameStr, " ", "")
'删除最后一位字符
nameStr = Left(nameStr, Len(nameStr) - 1)
'字符串转数组
nameArr = Split(nameStr, sign)

'循环数组
For Each strItem In nameArr
    Dim sartIndex As Integer
    Dim name As String
    
    '查找英文括号位置
    sartIndex = InStr(strItem, "(")
    '如果没有找到，则查找中文括号
    If sartIndex = 0 Then
       sartIndex = InStr(strItem, "（")
    End If
    
    '如果找到括号截取字符串
    If sartIndex > 0 Then
        name = Left(strItem, sartIndex - 1)
    Else
        name = strItem
    End If

    '向对象集合添加键值对
    strDic.Item(name) = name
Next

nameStr = ""

'循环对象集合
For Each Key In strDic
    '拼接结果字符串
    nameStr = nameStr + strDic(Key) + sign
Next

nameStr = Left(nameStr, Len(nameStr) - 1)

range_duplicate_removal_beta = nameStr

End Function

